import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../common/style/colors.dart';
import '../../component/image_view.dart';
import 'splash_logic.dart';

class SplashPage extends StatelessWidget {
  SplashPage({super.key});

  @override
  Widget build(BuildContext context) {
    var height = MediaQuery.of(context).size.height;
    return GetBuilder<SplashLogic>(builder: (vm) {
      return Scaffold(
        body: Container(
          width: double.maxFinite,
          height: height,
          decoration: BoxDecoration(image: DecorationImage(image: AssetImage('assets/images/welcome.9.png',),fit: BoxFit.fill)),
        ),
      );
    });
  }

  Widget _buildLogoAndSlogan(BuildContext context) {
    var viewModel = Get.find<SplashLogic>();
    return Container(
      padding: EdgeInsets.only(top: viewModel.animation.value),
      child: Row(
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[_buildLogo(context), _buildSlogan()],
      ),
    );
  }

  Widget _buildLogo(BuildContext context) {
    return Container(
      width: 26.r,
      height: 26.r,
      margin: const EdgeInsets.only(right: 6.00),
      child: const ImageView(
        url: "assets/images/ic_launcher.png",
      ),
    );
  }

  Widget _buildSlogan() {
    return SingleChildScrollView(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Text(
            "热爱而专注",
            style: TextStyle(fontSize: 12.sp, color: AppColors.color99, fontFamily: "PingFang SC"),
          ),
        ],
      ),
    );
  }
}
